import React, { Component } from 'react'
import {SpecialWrap} from '../Home'
import {get} from '../../utils/http'
import {withRouter} from 'react-router-dom'

@withRouter
 class Special extends Component {
    constructor(){
        super()
        this.state={
            data:[]
        }
    }
   async componentDidMount(){
        let result=await get('https://m.tuniu.com/travel/mapi/channel/getCmsChannelAjax?pageId=2698&cityCode=200')
        this.setState({
            data:result.data.data[3].gItems[1].mItems.splice(0,2)
        })
    }
    render() {
        return (
            <SpecialWrap>
                <p><i></i> <span>尾货特价</span></p>
                <ul>
                    {
                        this.state.data.map((value,index)=>{
                     return   ( <li key={value+index}>
                        <div>
                            <img src={value.prdImgUrl} alt=""/>
                        </div>
                        <div>
                            <h4>{value.prdName}</h4>
                           <h5>{value.prdSubtitle}</h5>
                        <h6><span>{value.prdClassBrandName}</span> <span><i>{value.prdSalePrice}</i>起/人</span></h6>
                        </div>
                     </li>  )  
                        })
                    }
                   
                </ul>
            </SpecialWrap>
        )
    }
}
export default Special